feat(pass-extension): add autofill keyboard shortcut command#481
feat(pass-extension): add autofill keyboard shortcut command#481yuribodo wants to merge 7 commits into
Conversation
|
Hi thanks for the MR, from what I understand, it simply opens the dropdown? Currently it already opens when the username/password field is in focus, which is the default behavior for most websites. |
Hi @nguyenkims , that's correct it opens the dropdown rather than firing autofill directly The difference from the default focus behavior is that this works keyboard-only, without the user having to click or tab into a field first. That's the main use case: power users who want to fill credentials without touching the mouse at all. The feature request in #453 has quite a bit of community interest, which is what motivated this contribution. Happy to discuss scope or adjust the approach if you have a different direction in mind! |
|
Thanks, but once the dropdown is shown, users still need to use the mouse to select a login. For a keyboard-centric experience, it'd be nice to let users navigate with the up/down arrow keys. |
…nd handle tab id 0
115579e to
b6fd253
Compare
The Ctrl+Shift+U shortcut opens the dropdown with autofocused:false, so neither the page field nor the iframe receives keyboard focus. Expose requestFocus() on the dropdown that reuses the existing focus-lock bypass, and call it once the dropdown is visible so the suggestions can be reached from the keyboard.
…keys Wire useDropdownArrowNavigation + useHotkeys (bound to the iframe document) in the login view so the suggestions can be moved through with the arrow keys, selected with Enter, and dismissed with Escape. Highlight the focused item in the injected dropdown styles.
b9a9fb0 to
d639fe2
Compare
Summary
Adds a keyboard shortcut to trigger autofill in the Proton Pass browser extension, as discussed and approved in #453.
autofillcommand in Chrome and Firefox manifests withCtrl+Shift+Uas the default shortcutAUTOFILL_TRIGGERmessage to the active tab's content scriptCloses #453
Changes
manifest-chrome.json"autofill"command entrymanifest-firefox.json"autofill"command entrysrc/types/messages.tsAUTOFILL_TRIGGERtoWorkerMessageTypeenumsrc/lib/extension/commands.ts"autofill"commandsrc/lib/extension/commands.spec.tssrc/app/content/services/autofill/autofill.service.tsAUTOFILL_TRIGGERhandler usingwithContextpatternHow it works
Ctrl+Shift+Ubrowser.commands.onCommandfires in the background scriptAUTOFILL_TRIGGERviabrowser.tabs.sendMessageFrameMessageBrokerreceives the messageDropdownAction.AUTOFILL_LOGINviaformManager.getFields()inline.dropdown.toggle()If no login field is detected on the page, the shortcut is a no-op.
Design decisions
Default shortcut
Ctrl+Shift+U: Chosen to avoid conflicts with existing commands (Ctrl+Shift+Xfor popup,Ctrl+Shift+Lfor larger window). The industry standard for autofill isCtrl+Shift+L(used by Bitwarden and LastPass). If the team is open to it, reassigningCtrl+Shift+Lfromopen-larger-windowtoautofillin a follow-up would align with user expectations from competing password managers.Dropdown approach (not direct autofill): Opens the dropdown instead of auto-filling the top match. This is safer, gives the user control when multiple credentials match, and reuses the existing dropdown infrastructure with minimal new code.
Safari excluded: Safari does not support the
browser.commandsAPI. The command listener is already gated byBUILD_TARGET !== 'safari'inworker/index.ts.Test plan
handleExtensionCommand(4 tests passing):open-larger-windowcommandAUTOFILL_TRIGGERto active tab forautofillcommandCtrl+Shift+Uon a login page → dropdown opens on first login fieldCtrl+Shift+Uon a page with no login form → nothing happensCtrl+Shift+XandCtrl+Shift+Lstill work as before